<!DOCTYPE html>
<html>
	<head>
		<title>Parser args Unit Test</title>
		<style type="text/css">     
			@import "../../resources/dojo.css";
		</style>
		<script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true, async:true"></script>
		<script type="text/javascript">
		require(["dojo/_base/lang", "dojo/_base/declare", "doh", "dojo/parser", "dojo/domReady!"],
				function(dlang, declare, doh, parser){

			var mixin = dlang.mixin,
				extend = dlang.extend,
				exists = dlang.exists;

			declare("tests.parser.Class1", null, {
				constructor: function(args, node){
					this.params = args;
					mixin(this, args);
				}, 
				strProp1: "original1",
				strProp2: "original2"
			});

			doh.register("args scope test", [
				function noArgs(){
					// Test calling parse() with no arguments.
					var widgets = parser.parse();
					doh.is(1, widgets.length, "found 1 widget");
					doh.is("text", widgets[0].strProp1);
				},
				function optionsOnly(){
					// Test when only the options argument is passed, and it does not contain a rootNode.
					// For 2.0, if we drop scope parameter, change this test.
					var widgets = parser.parse({
						scope: "myscope"
					});
					doh.is(1, widgets.length, "found 1 widget");
					doh.is("text", scopeObj.strProp1);
				}
			]);

			doh.run();
		});
		</script>
	</head>
	<body>
		<h1>Parser args Unit Test</h1>

		<div data-myscope-type="tests.parser.Class1" data-myscope-id="scopeObj"
			 data-myscope-props="strProp1:'text'">
		</div>
		<div data-dojo-type="tests.parser.Class1" data-dojo-id="normalObj"
			 data-dojo-props="strProp1:'text'">
		</div>
	</body>
</html>
